package com.example.demo.mapper;

import com.example.demo.entity.WarningInfos;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;

@Mapper
public interface WarningInfoMapper {
    @Select("select * from warninginformation")
    List<WarningInfos> selectAll();

    @Select("select * from warninginformation where stuid=#{stuid}")
    List<WarningInfos> selectbyid(int stuid);

    @Select("select * from warninginformation where term=#{term}")
    List<WarningInfos> selectbyTerm(String  term);

    @Select("select * from warninginformation where warningid=#{warningid}")
    WarningInfos selectByWarningId(int warningid);

    @Insert("insert into warninginformation(warningid,stuname,stuid,stumajor,stuclassi,warningtype,warningdetail,term,createtime,utime,status,flag) values (#{warningid},#{stuname},#{stuid},#{stumajor},#{stuclassi},#{warningtype},#{warningdetail},#{term},#{createtime},#{utime},#{status},#{flag})")
    int addWarningInfo(WarningInfos w);

    @Update("update warninginformation set warningtype=#{warningtype},warningdetail=#{warningdetail},utime=#{utime} where warningid=#{warningid}")
    int updateWarningInfo(int warningtype, String warningdetail, Date utime,int warningid);

    @Update("update warninginformation set warningtype=#{warningtype},warningdetail=#{warningdetail},status=#{status},utime=#{utime} where warningid=#{warningid}")
    int checkWarningInfo(int warningtype, String warningdetail, Date utime,int status,int warningid);

    @Delete("delete from warninginformation where warningid=#{warningid}")
    int delete(int warningid);
}
